@dss-kit/ui-kit 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  import { jsx as o, jsxs as v } from "react/jsx-runtime";
2
2
  import { cx as p, css as b } from "@emotion/css";
3
- import { useReactTable as He, getPaginationRowModel as Me, getSortedRowModel as Ne, getCoreRowModel as ke, flexRender as H, createColumnHelper as Ie } from "@tanstack/react-table";
4
- import { useMemo as ze, useImperativeHandle as Ve } from "react";
3
+ import { useReactTable as He, getPaginationRowModel as Me, getSortedRowModel as Ne, getCoreRowModel as ke, flexRender as H, createColumnHelper as ze } from "@tanstack/react-table";
4
+ import { useMemo as Ie, useImperativeHandle as Ve } from "react";
5
5
  import Le from "../../../assets/svg/table/search.svg.js";
6
- import { styles as Ee } from "./styles.js";
7
- import { useControllableState as s } from "./Table.hooks.js";
6
+ import { typography as We } from "../../../styles/utils/typography.js";
7
+ import { useControllableState as m } from "./Table.hooks.js";
8
8
  import { getColumnPinningStyles as f } from "./Table.utils.js";
9
- import { TablePlaceholder as Fe } from "./TablePlaceholder/TablePlaceholder.js";
10
- import { TableWrapper as We } from "./TableWrapper/TableWrapper.js";
9
+ import { TablePlaceholder as Ee } from "./TablePlaceholder/TablePlaceholder.js";
10
+ import { TableWrapper as Fe } from "./TableWrapper/TableWrapper.js";
11
11
  import { TableHeadRow as je } from "./TableHeadRow/TableHeadRow.js";
12
12
  import { TablePagination as Be } from "./TablePagination/TablePagination.js";
13
13
  import { TableHeadCell as De } from "./TableHeadCell/TableHeadCell.js";
@@ -19,32 +19,34 @@ import { TableHeadCellContent as Oe } from "./TableHeadCellContent/TableHeadCell
19
19
  import { TableHeadCellContentSortable as $e } from "./TableHeadCellContentSortable/TableHeadCellContentSortable.js";
20
20
  import { theme as qe } from "../../../utils/theme/index.js";
21
21
  import { Box as Ge } from "../Box/Box.js";
22
- const { spacing: M, color: t } = qe, Je = b({
22
+ const { spacing: M, color: l } = qe, Je = b({
23
+ ...We.body2,
24
+ fontWeight: 500,
23
25
  width: "100%",
24
26
  maxWidth: "100%",
25
27
  minWidth: "max-content",
26
28
  borderCollapse: "collapse",
27
29
  borderSpacing: 0,
28
- backgroundColor: t.fill.bgPrimary
30
+ backgroundColor: l.fill.bgPrimary
29
31
  }), Qe = b({
30
- backgroundColor: t.fill.bgSecondary,
31
- color: t.text.tertiary
32
+ backgroundColor: l.fill.bgSecondary,
33
+ color: l.text.tertiary
32
34
  }), Ue = b({
33
35
  pointerEvents: "none",
34
36
  userSelect: "none"
35
37
  }), N = ["70%", "55%", "80%", "60%"], c = ({
36
- ref: I,
38
+ ref: z,
37
39
  data: h,
38
40
  columns: u,
39
41
  showBorders: g = !0,
40
- enableSorting: z = !1,
42
+ enableSorting: I = !1,
41
43
  enablePagination: S = !1,
42
44
  enableRowSelection: V = !1,
43
45
  enableMultiRowSelection: L = !1,
44
46
  enableColumnPinning: d = !1,
45
- columnPinning: E,
46
- onColumnPinningChange: F,
47
- sorting: W,
47
+ columnPinning: W,
48
+ onColumnPinningChange: E,
49
+ sorting: F,
48
50
  onSortingChange: j,
49
51
  manualSorting: B,
50
52
  columnFilters: D,
@@ -55,7 +57,7 @@ const { spacing: M, color: t } = qe, Je = b({
55
57
  onPaginationChange: $,
56
58
  rowSelection: q,
57
59
  onRowSelectionChange: G,
58
- totalCount: m,
60
+ totalCount: s,
59
61
  loading: i = !1,
60
62
  loadingRowCount: J = 10,
61
63
  emptyLabels: Q = {
@@ -70,47 +72,47 @@ const { spacing: M, color: t } = qe, Je = b({
70
72
  emptyStateClassName: Z,
71
73
  emptyStateTitleClassName: ee,
72
74
  emptyStateDescriptionClassName: oe,
73
- paginationClassName: le,
74
- tableOptions: ne = {},
75
+ paginationClassName: ne,
76
+ tableOptions: te = {},
75
77
  onRowClick: w,
76
- getRowId: te,
78
+ getRowId: le,
77
79
  headCellComponent: ie = De,
78
80
  bodyCellComponent: x = _e,
79
81
  headRowComponent: ae = je,
80
82
  bodyRowComponent: R = Ae,
81
83
  onReset: re,
82
- paginationVariant: se,
83
- paginationLabels: me,
84
+ paginationVariant: me,
85
+ paginationLabels: se,
84
86
  renderPageSizeSelectorDropdownItem: ce,
85
87
  renderPageSizeSelectorInputItem: ge
86
88
  }) => {
87
- const [de, pe] = s(
88
- W,
89
+ const [de, pe] = m(
90
+ F,
89
91
  j,
90
92
  []
91
- ), [he, Ce] = s(
93
+ ), [he, Ce] = m(
92
94
  D,
93
95
  _,
94
96
  []
95
- ), [fe, be] = s(
97
+ ), [fe, be] = m(
96
98
  A,
97
99
  K,
98
100
  {}
99
- ), [a, C] = s(
101
+ ), [a, C] = m(
100
102
  O,
101
103
  $,
102
104
  { pageIndex: 0, pageSize: 10 }
103
- ), [ue, Se] = s(q, G, {}), [ye, we] = s(
105
+ ), [ue, Se] = m(q, G, {}), [ye, we] = m(
106
+ W,
104
107
  E,
105
- F,
106
108
  { left: [], right: [] }
107
- ), T = B ?? !!m, xe = ze(
109
+ ), T = B ?? !!s, xe = Ie(
108
110
  () => u.map((e) => ({
109
111
  enableSorting: !1,
110
112
  ...e
111
113
  })),
112
114
  [u]
113
- ), n = He({
115
+ ), t = He({
114
116
  data: h,
115
117
  columns: xe,
116
118
  state: {
@@ -128,41 +130,40 @@ const { spacing: M, color: t } = qe, Je = b({
128
130
  onRowSelectionChange: Se,
129
131
  onColumnPinningChange: we,
130
132
  getCoreRowModel: ke(),
131
- getSortedRowModel: z && !T ? Ne() : void 0,
133
+ getSortedRowModel: I && !T ? Ne() : void 0,
132
134
  getPaginationRowModel: S ? Me() : void 0,
133
135
  enableRowSelection: V,
134
136
  enableMultiRowSelection: L,
135
137
  enableColumnPinning: d,
136
- getRowId: te,
138
+ getRowId: le,
137
139
  manualSorting: T,
138
- manualPagination: !!m,
139
- pageCount: m ? Math.ceil(m / a.pageSize) : void 0,
140
- ...ne
140
+ manualPagination: !!s,
141
+ pageCount: s ? Math.ceil(s / a.pageSize) : void 0,
142
+ ...te
141
143
  });
142
- Ve(I, () => n);
143
- const { rows: P } = n.getRowModel(), Re = (e, l) => {
144
- w && w(e.original, l);
144
+ Ve(z, () => t);
145
+ const { rows: P } = t.getRowModel(), Re = (e, n) => {
146
+ w && w(e.original, n);
145
147
  }, Te = (e) => /* @__PURE__ */ o(
146
148
  ie,
147
149
  {
148
150
  style: {
149
151
  width: e.getSize(),
150
- ...d && f(n, e.column, t.fill.bgSecondary)
152
+ ...d && f(t, e.column, l.fill.bgSecondary)
151
153
  },
152
154
  onClick: i ? void 0 : e.column.getToggleSortingHandler(),
153
155
  children: e.isPlaceholder ? null : H(e.column.columnDef.header, e.getContext())
154
156
  },
155
157
  e.id
156
- ), Pe = (e, l) => /* @__PURE__ */ o(
158
+ ), Pe = (e, n) => /* @__PURE__ */ o(
157
159
  R,
158
160
  {
159
161
  showBorders: g,
160
- isSelected: e.getIsSelected(),
161
- onClick: () => Re(e, l),
162
+ onClick: () => Re(e, n),
162
163
  children: e.getVisibleCells().map((r) => /* @__PURE__ */ o(
163
164
  x,
164
165
  {
165
- style: d ? f(n, r.column, t.fill.bgPrimary) : void 0,
166
+ style: d ? f(t, r.column, l.fill.bgPrimary) : void 0,
166
167
  children: H(r.column.columnDef.cell, r.getContext())
167
168
  },
168
169
  r.id
@@ -173,10 +174,10 @@ const { spacing: M, color: t } = qe, Je = b({
173
174
  R,
174
175
  {
175
176
  showBorders: g,
176
- children: n.getVisibleLeafColumns().map((l, r) => /* @__PURE__ */ o(
177
+ children: t.getVisibleLeafColumns().map((n, r) => /* @__PURE__ */ o(
177
178
  x,
178
179
  {
179
- style: d ? f(n, l, t.fill.bgPrimary) : void 0,
180
+ style: d ? f(t, n, l.fill.bgPrimary) : void 0,
180
181
  children: /* @__PURE__ */ o(k, { children: /* @__PURE__ */ o(
181
182
  Ke,
182
183
  {
@@ -186,20 +187,20 @@ const { spacing: M, color: t } = qe, Je = b({
186
187
  }
187
188
  ) })
188
189
  },
189
- l.id
190
+ n.id
190
191
  ))
191
192
  },
192
193
  `skeleton-row-${e}`
193
194
  );
194
195
  return !i && !P.length ? /* @__PURE__ */ o(
195
- Fe,
196
+ Ee,
196
197
  {
197
198
  icon: /* @__PURE__ */ o(
198
199
  Le,
199
200
  {
200
201
  width: 24,
201
202
  height: 24,
202
- style: { color: t.icon.tertiary, marginBottom: M.sm }
203
+ style: { color: l.icon.tertiary, marginBottom: M.sm }
203
204
  }
204
205
  ),
205
206
  labels: Q,
@@ -209,7 +210,7 @@ const { spacing: M, color: t } = qe, Je = b({
209
210
  descriptionClassName: oe
210
211
  }
211
212
  ) : /* @__PURE__ */ v(Ge, { w: "full", gap: M.xl, className: p(y), children: [
212
- /* @__PURE__ */ o(We, { data: h, showBorders: g, children: /* @__PURE__ */ v("table", { className: p(Je, Ee.table, U), children: [
213
+ /* @__PURE__ */ o(Fe, { data: h, showBorders: g, children: /* @__PURE__ */ v("table", { className: p(Je, U), children: [
213
214
  /* @__PURE__ */ o(
214
215
  "thead",
215
216
  {
@@ -219,27 +220,27 @@ const { spacing: M, color: t } = qe, Je = b({
219
220
  X
220
221
  ),
221
222
  "aria-busy": i,
222
- children: n.getHeaderGroups().map((e) => /* @__PURE__ */ o(ae, { showBorders: g, children: e.headers.map(Te) }, e.id))
223
+ children: t.getHeaderGroups().map((e) => /* @__PURE__ */ o(ae, { showBorders: g, children: e.headers.map(Te) }, e.id))
223
224
  }
224
225
  ),
225
226
  /* @__PURE__ */ o("tbody", { className: Y, children: i ? Array.from(
226
227
  { length: J },
227
- (e, l) => ve(l)
228
- ) : P.map((e, l) => Pe(e, l)) })
228
+ (e, n) => ve(n)
229
+ ) : P.map((e, n) => Pe(e, n)) })
229
230
  ] }) }),
230
231
  S && !i && /* @__PURE__ */ o(
231
232
  Be,
232
233
  {
233
234
  pageIndex: a.pageIndex,
234
235
  pageSize: a.pageSize,
235
- totalCount: m || h.length,
236
- variant: se,
237
- labels: me,
236
+ totalCount: s || h.length,
237
+ variant: me,
238
+ labels: se,
238
239
  renderPageSizeSelectorDropdownItem: ce,
239
240
  renderPageSizeSelectorInputItem: ge,
240
241
  onPageChange: (e) => C({ ...a, pageIndex: e }),
241
242
  onPageSizeChange: (e) => C({ ...a, pageSize: e, pageIndex: 0 }),
242
- className: le
243
+ className: ne
243
244
  }
244
245
  )
245
246
  ] });
@@ -248,7 +249,7 @@ c.displayName = "Table";
248
249
  c.HeadCellContent = Oe;
249
250
  c.BodyCellContent = k;
250
251
  c.HeadCellContentSortable = $e;
251
- c.createColumnHelper = Ie;
252
+ c.createColumnHelper = ze;
252
253
  export {
253
254
  c as Table
254
255
  };
@@ -4,10 +4,5 @@ export interface TableBodyRowProps extends React.HTMLAttributes<HTMLTableRowElem
4
4
  * @default false
5
5
  */
6
6
  showBorders?: boolean;
7
- /**
8
- * Выбрана ли строка
9
- * @default false
10
- */
11
- isSelected?: boolean;
12
7
  }
13
8
  export declare const TableBodyRow: import('react').ForwardRefExoticComponent<TableBodyRowProps & import('react').RefAttributes<HTMLTableRowElement>>;
@@ -1,16 +1,20 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { css as a, cx as c } from "@emotion/css";
3
- import { forwardRef as d } from "react";
4
- import { theme as f } from "../../../../utils/theme/index.js";
5
- const { color: n } = f, p = d(
6
- ({ children: o, className: r, showBorders: e = !1, isSelected: i = !1, ...t }, s) => {
7
- const l = a({
8
- borderBottom: e ? `1px solid ${n.border.neutralAlphaLow}` : "none"
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { css as m, cx as c } from "@emotion/css";
3
+ import { forwardRef as i } from "react";
4
+ import { theme as d } from "../../../../utils/theme/index.js";
5
+ const { color: o } = d, f = i(
6
+ ({ children: r, className: e, showBorders: t = !1, ...a }, l) => {
7
+ const s = m({
8
+ borderBottom: t ? `1px solid ${o.border.neutralAlphaLow}` : "none",
9
+ transition: "background-color 0.15s ease-in-out",
10
+ "&:hover": {
11
+ backgroundColor: o.fill.neutralPrimaryHover
12
+ }
9
13
  });
10
- return /* @__PURE__ */ m("tr", { ref: s, className: c(l, r), ...t, children: o });
14
+ return /* @__PURE__ */ n("tr", { ref: l, className: c(s, e), ...a, children: r });
11
15
  }
12
16
  );
13
- p.displayName = "TableBodyRow";
17
+ f.displayName = "TableBodyRow";
14
18
  export {
15
- p as TableBodyRow
19
+ f as TableBodyRow
16
20
  };
@@ -1,9 +1,9 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { css as n, cx as d } from "@emotion/css";
3
- import { memo as F, useState as f, useRef as L, useCallback as k, useEffect as E } from "react";
4
- import { theme as W } from "../../../../utils/theme/index.js";
5
- import { Box as b } from "../../Box/Box.js";
6
- const { color: s, cornerRadius: C } = W, z = n({
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { css as n, cx as f } from "@emotion/css";
3
+ import { memo as k, useState as d, useRef as x, useCallback as E, useEffect as W } from "react";
4
+ import { theme as $ } from "../../../../utils/theme/index.js";
5
+ import { Box as m } from "../../Box/Box.js";
6
+ const { color: o, cornerRadius: C } = $, P = n({
7
7
  position: "relative",
8
8
  borderRadius: C.md,
9
9
  overflow: "hidden",
@@ -14,66 +14,65 @@ const { color: s, cornerRadius: C } = W, z = n({
14
14
  bottom: 14,
15
15
  width: 96,
16
16
  pointerEvents: "none",
17
- zIndex: 1,
18
17
  transition: "opacity 0.2s ease"
19
18
  },
20
19
  "&::before": {
21
20
  left: 0,
22
- background: "linear-gradient(to left, rgba(255, 255, 255, 0.00) 0%, #FFF 100%)"
21
+ background: `linear-gradient(to left, transparent 0%, ${o.fill.bgPrimary} 100%)`
23
22
  },
24
23
  "&::after": {
25
24
  right: 0,
26
- background: "linear-gradient(to right, rgba(255, 255, 255, 0.00) 0%, #FFF 100%)"
25
+ background: `linear-gradient(to right, transparent 0%, ${o.fill.bgPrimary} 100%)`
27
26
  }
28
27
  }), N = n({
29
28
  overflowX: "auto",
30
29
  scrollbarWidth: "thin",
31
- scrollbarColor: `${s.scrollbar.thumbPrimary} ${s.scrollbar.trackPrimary}`
32
- }), T = F(
30
+ scrollbarColor: `${o.scrollbar.thumbPrimary} ${o.scrollbar.trackPrimary}`
31
+ }), T = k(
33
32
  ({
34
- data: m,
33
+ data: b,
35
34
  children: h,
36
35
  className: p,
37
36
  scrollContainerClassName: u,
38
37
  showBorders: w = !1,
39
- ...S
38
+ ...y
40
39
  }) => {
41
- const [g, v] = f(!1), [y, R] = f(!1), t = L(null), r = k(() => {
42
- const e = t.current;
43
- if (!e) return;
44
- const { scrollLeft: o, scrollWidth: a, clientWidth: l } = e, c = a > l;
45
- v(c && o > 0), R(
46
- c && o < a - l - 1
40
+ const [S, g] = d(!1), [v, R] = d(!1), s = x(null), e = E(() => {
41
+ const r = s.current;
42
+ if (!r) return;
43
+ const { scrollLeft: t, scrollWidth: a, clientWidth: l } = r, i = a > l;
44
+ g(i && t > 0), R(
45
+ i && t < a - l - 1
47
46
  );
48
47
  }, []);
49
- E(() => {
50
- const e = t.current;
51
- if (!e) return;
52
- r();
53
- const o = new ResizeObserver(r);
54
- return o.observe(e), e.addEventListener("scroll", r), () => {
55
- o.disconnect(), e.removeEventListener("scroll", r);
48
+ W(() => {
49
+ const r = s.current;
50
+ if (!r) return;
51
+ e();
52
+ const t = new ResizeObserver(e);
53
+ return t.observe(r), r.addEventListener("scroll", e), () => {
54
+ t.disconnect(), r.removeEventListener("scroll", e);
56
55
  };
57
- }, [r, m]);
58
- const x = n({
59
- border: w ? `1px solid ${s.border.neutralAlphaLow}` : "transparent",
56
+ }, [e, b]);
57
+ const L = n({
58
+ border: w ? `1px solid ${o.border.neutralAlphaLow}` : "transparent",
60
59
  "&::before": {
61
- opacity: g ? 1 : 0
60
+ opacity: S ? 1 : 0
62
61
  },
63
62
  "&::after": {
64
- opacity: y ? 1 : 0
63
+ opacity: v ? 1 : 0
65
64
  }
66
65
  });
67
- return /* @__PURE__ */ i(
68
- b,
66
+ return /* @__PURE__ */ c(
67
+ m,
69
68
  {
70
- className: d(z, x, p),
71
- ...S,
72
- children: /* @__PURE__ */ i(
73
- b,
69
+ className: f(P, L, p),
70
+ ...y,
71
+ children: /* @__PURE__ */ c(
72
+ m,
74
73
  {
75
- ref: t,
76
- className: d(N, u),
74
+ ref: s,
75
+ className: f(N, u),
77
76
  children: h
78
77
  }
79
78
  )